home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8833 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: druid.borland.com!usenet
  2. From: pete@borland.com (Pete Becker)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: f;oating point precision
  5. Date: 6 Mar 1996 16:12:21 GMT
  6. Organization: Borland International
  7. Message-ID: <4hkdh5$md1@druid.borland.com>
  8. References: <c0d_9603050128@csource.blaze.net.au> <826027830snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: pbecker.borland.com
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=ISO-8859-1
  12. X-Newsreader: WinVN 0.99.5
  13.  
  14. In article <826027830snz@genesis.demon.co.uk>, fred@genesis.demon.co.uk 
  15. says...
  16. >
  17. >In article <c0d_9603050128@csource.blaze.net.au>
  18. >           David.Burrows@f158.n633.z3.fidonet.org "David Burrows" writes:
  19. >
  20. >>Help.... I am getting floating point innaccuracies at about the 4th decimal
  21. >>
  22. >>place. eg i enter 510.0250 and it comes out as 510.0249.
  23. >>I am just starting to learn c so please excuse my ignorance.
  24. >
  25. >You don't give anyindication of what your code does or what (precise)
  26. >types of variable it uses so any answer to your question can only be a guess.
  27. >
  28. >That corresponds to an error in the 7th significant digit which is all you
  29. >can expect from float variables. If you want more precision you should
  30. >use double. Floating point errors are cumulative so if you are performing
  31. >a long calculation (such as in a loop) your results will become
  32. >progressively less precise.
  33.  
  34. Picking nits here: the results will always be equally precise, but they will 
  35. become progressively less accurate.
  36.  
  37.